/**
 * Copyright:Copyright(c)2014-2015
 * Company:厦门市易致达物联网科技有限公司
 * @version 1.0
 */
package shop.services.front.wallet.impl;

import shop.core.ServicesManager;
import shop.services.front.record.bean.Record;
import shop.services.front.record.dao.RecordDao;
import shop.services.front.wallet.WalletService;
import shop.services.front.wallet.bean.Wallet;
import shop.services.front.wallet.dao.WalletDao;
import org.springframework.stereotype.Service;
import shop.services.manage.system.bean.User;
import shop.services.manage.system.impl.UserService;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;


/**   
 * @类名称：WalletServiceImpl      
 * @创建人：Ltz   
 * @创建时间：2017-09-20 下午15:55:25        
 * @版本号：1.0
 * @描述：     
 */
@Service("walletServiceFront")
public class WalletServiceImpl extends ServicesManager<Wallet, WalletDao> implements
WalletService {
    @Resource(name = "walletDaoFront")
    @Override
    public void setDao(WalletDao walletDao) {
    this.dao = walletDao;
    }
    @Resource(name = "recordDaoFront")
    private RecordDao recordDao;
    @Resource
    private UserService userService;

//    public int insert(HttpServletRequest request,Wallet wallet) {
//        dao.insert(wallet);
//        User user = (User) request.getSession().getAttribute("userInfo");
//        int transID =dao.insert(wallet);//插入提现表
//        user.setWalletMoney(user.getWalletMoney().subtract(wallet.getMoney()));
//        userService.update(user);//更新用户钱包
//        Record record=new Record();
//        record.setUserID(user.getId());
//        record.setTransType("0");
//        record.setTransID(String.valueOf(transID));
//        record.setMoney(wallet.getMoney());
//        recordDao.insert(record);//插入交易记录表
//        return transID;
//    }
}

